<template>
  <div class="set-first-div" style="height: calc(100vh - 198px);">
    <div :class="wcDivClassArr">
        <img :src="resultData.rqCode"/>
    </div>
    <div class="set-div-y">
      <a-form
        :form="form"
        :label-col="{ span:  15}"
        :wrapper-col="{ span: 7 }"
        @submit="handleSubmit"
      >
        <a-form-item label="姓名">
          <a-input v-model="resultData.displayName" readOnly  />
        </a-form-item>
        <a-form-item label="账号">
            <a-input v-model="resultData.username" readOnly  />
        </a-form-item>
        <a-form-item label="长度">
            <a-input v-model="resultData.digits" readOnly  />
        </a-form-item>
        <a-form-item label="周期">
            <a-input v-model="resultData.period" readOnly  />
        </a-form-item>
        <a-form-item label="共享密钥(BASE32)">
            <a-input v-model="resultData.sharedSecret" readOnly  />
        </a-form-item>
        <a-form-item label="共享密钥( HEX )">
            <a-input v-model="resultData.hexSharedSecret" readOnly  />
        </a-form-item>
        <a-form-item :wrapper-col="{ span: 15, offset: 17 }">
          <a-button type="primary" @click="create('YES')"> 生成 </a-button>
        </a-form-item>
      </a-form>
    </div>
  </div>
  
</template>

<script>
import dispose from "../../api/dispose";
export default {
  data() {
    return {
      wcDivClassArr: ["set-dier-div", "set-div-display"],
      lcDivClassArr: ["set-div-display", "set-disan-div"],
      resultData:{}
    };
  },
  mounted() {
    this.getTimeToken('NO')
  },
  methods:{
    getTimeToken(val){
        dispose.timeTokenApi(val).then((res)=>{
            if(res.data.code==0){
                this.resultData=res.data.data
            }
        })
    },
    create(val){
        this.getTimeToken(val);
    }
  }
};
</script>

<style>
.set-first-div {
  width: auto;
  height: 500px;
  background-color: white;
}

.set-dier-div {
  width: 300px;
  height: 300px;
  margin-left: 100px;
  margin-top: 50px;
  display: inline-block;
}
.set-div-display {
  display: inline-block;
}
.set-disan-div {
  padding-left: 200px;
}
.set-div-y{
    transform:translateY(-75%)
}
</style>